package com.grape.feign;

import com.grape.entity.SysOperateLog;
import com.grape.entity.SysPermission;
import com.grape.entity.SysRole;
import com.grape.entity.SysUser;
import com.grape.feign.callback.UserFeignCallback;
import com.grape.result.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author fuhehuang
 * @email 2628279194@qq.com
 */
/**
 * user的feign接口
 */
@FeignClient(name = "system-service", fallback = UserFeignCallback.class)
public interface UserFeign {

    @GetMapping("/users/getByUsername")
    R getByUsername(@RequestParam(value = "username") String username);

    @GetMapping("/users/getByPhone")
    R<SysUser> getByPhone(@RequestParam(value = "phone") String phone);

    @GetMapping("/users/getByUserId")
    R<SysUser> getByUserId(@RequestParam(value = "userId") String userId);

    @GetMapping("/users/getPermissionByUserId")
    R<List<SysPermission>> getPermissionByUserId(@RequestParam(value = "userId") String userId);

    @PostMapping("/operateLogs")
    R insert(@RequestBody SysOperateLog sysOperateLog);

}
